<template>
	<view :style="themeColor">
		<view class="page">
			<view
				class="flex benben-position-layout flex flex-wrap align-center likeandPage_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }"
			>
				<view class='flex flex-wrap align-center justify-between flex-sub likeandPage_fd0_0'>
					<view
						class='flex flex-wrap align-center likeandPage_fd0_0_c0'
						@tap.stop="handleJumpDiy"
						data-type="back"
						data-url="1"
					>
						<text class='fu-iconfont2  likeandPage_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view
						class='flex flex-wrap align-stretch justify-center'
						style="font-family: Alimama DongFangDaKai, Alimama DongFangDaKai;"
					>
						<text
							class='likeandPage_fd0_0_c1_c0'
							v-if="type=='1'"
						>收到的赞和收藏</text><text
							class='likeandPage_fd0_0_c1_c0'
							v-if="type=='2'"
						>收到的评论</text>
					</view>
					<view class='flex flex-wrap align-center justify-end likeandPage_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

			<view
				class="loading_css"
				v-if="isShow"
			>
				<u-loading
					size="36"
					color="#AD3823"
				></u-loading>
				<view>加载中</view>
			</view>
			<block v-else>
				<!---flex布局flex布局开始-->
				<view
					class="flex flex-direction flex-wrap align-stretch benben-flex-layout likeandPage_flex_1"
					v-if=" type=='1'"
				>
					<view class='flex flex-direction flex-wrap align-stretch'>
						<view
							class='flex flex-wrap align-center likeandPage_fd1_0_c0'
							v-for="(item, index) in list"
							:key="index"
						>
							<image
								class='likeandPage_fd1_0_c0_c0'
								mode="aspectFill"
								:src='item.head_img'
								@tap.stop="handleJumpDiy"
								data-type="navigateTo"
								:data-url="`/pages/othersPage/othersPage/othersPage?user_id=${item.from_user_id}`"
							></image>
							<view class='flex flex-direction flex-wrap align-stretch likeandPage_fd1_0_c0_c1'>
								<text class='likeandPage_fd1_0_c0_c1_c0' style="font-family: Source Han Sans CN, Source Han Sans CN;">{{item.user_nickname}}</text>
								<view class='flex flex-wrap align-center' style="font-family: Source Han Sans CN, Source Han Sans CN;">
									<text class='likeandPage_fd1_0_c0_c1_c1_c0'>{{item.brief}}</text>
									<text class='likeandPage_fd1_0_c0_c1_c1_c1'>{{item.create_time}}</text>
								</view>
							</view>
							<image
								class='likeandPage_fd1_0_c0_c2'
								mode="aspectFill"
								:src='item.thumb'
								@tap.stop="imageClick(item)"
							></image>
						</view>
						<view
							class="loadmore"
							v-if="last_page > 1"
						>
							<u-loadmore
								font-size="24"
								:status="status"
								:icon-type="iconType"
								:load-text="loadText"
							/>
						</view>
					</view>

					<view
						class="noData"
						v-if="list.length == 0 && !isShow"
					>
						<image :src='STATIC_URL+"no.png"'></image>
					</view>
				</view>


				<!---flex布局flex布局结束-->
				<!---flex布局flex布局开始-->
				<view
					class="flex flex-direction flex-wrap align-stretch benben-flex-layout likeandPage_flex_2"
					v-if=" type=='2'"
				>
					<view class='flex flex-direction flex-wrap align-stretch'>
						<view
							class='flex flex-wrap align-start likeandPage_fd2_0_c0'
							v-for="(item, index) in commonList"
							:key="index"
						>
							<image
								class='likeandPage_fd2_0_c0_c0'
								mode="aspectFill"
								:src='item.head_img'
								@tap.stop="handleJumpDiy"
								data-type="navigateTo"
								:data-url="`/pages/othersPage/othersPage/othersPage?user_id=${item.from_user_id}`"
							></image>
							<view class='flex flex-direction flex-wrap align-stretch likeandPage_fd2_0_c0_c1'>
								<text class='likeandPage_fd2_0_c0_c1_c0' style="font-family: Source Han Sans CN, Source Han Sans CN;">{{item.user_nickname}}</text>
								<view class='flex flex-wrap align-center' style="font-family: Source Han Sans CN, Source Han Sans CN;">
									<text class='likeandPage_fd2_0_c0_c1_c1_c0'>{{item.brief}}</text>
									<text class='likeandPage_fd2_0_c0_c1_c1_c1'>{{item.create_time}}</text>
								</view>
								<view class='likeandPage_fd2_0_c0_c1_c2' style="font-family: Source Han Sans CN, Source Han Sans CN;">{{item.content}}</view>
								<view
									class='flex flex-wrap align-center justify-center likeandPage_fd2_0_c0_c1_c3'
									@tap.stop="imageClick(item)"
								>
									<image
										class='likeandPage_fd2_0_c0_c1_c3_c0'
										mode="aspectFit"
										:src='STATIC_URL+"679.png"'
									></image>
									<text class='likeandPage_fd2_0_c0_c1_c3_c1' style="font-family: Source Han Sans CN, Source Han Sans CN;">回复评论</text>
								</view>
							</view>
							<image
								class='likeandPage_fd2_0_c0_c2'
								mode="aspectFill"
								:src='item.thumb'
								@tap.stop="imageClick(item)"
							></image>
						</view>
						<view
							class="loadmore"
							v-if="last_page > 1"
						>
							<u-loadmore
								font-size="24"
								:status="status"
								:icon-type="iconType"
								:load-text="loadText"
							/>
						</view>
					</view>

					<view
						class="noData"
						v-if="commonList.length == 0 && !isShow"
					>
						<image :src='STATIC_URL+"no.png"'></image>
					</view>
				</view>

			</block>
		</view>
	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"type": "1", // 1赞和收藏  2收到的评论
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
				"commonList": [],
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let { type } = options;
			if (type !== undefined) this.type = type;
			if (this.type == 1) {
				this.getList();
			} else if (this.type == 2) {
				this.getPinglun();
			}

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			if (this.type == 1) {
				this.getList();
			} else if (this.type == 2) {
				this.getPinglun();
			}
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {

				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				if (this.type == 1) {
					this.getList();
				} else if (this.type == 2) {
					this.getPinglun();
				}
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			// 赞和收藏列表  655317a90981c
			getList() {
				this.$api.post(global.API_VERSION + '655317a90981c', {
					page: this.page,
				}).then(res => {
					// console.log(res);
					uni.stopPullDownRefresh();
					this.isShow = false;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			// 评论  655317d5727f0
			getPinglun() {
				this.$api.post(global.API_VERSION + '655317d5727f0', {
					page: this.page,
				}).then(res => {
					console.log(res);
					uni.stopPullDownRefresh();
					this.isShow = false;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.commonList = res.data.data.data;
						} else {
							this.commonList = this.commonList.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			imageClick(item) {
				// data_type 1 文章  2视频
				if (item.data_type == 1) {
					uni.navigateTo({
						url: '/pages/guanzhu/maTtention/maTtention?id=' + item.item_id
					})
				}
			},
		}
	};
</script>
<style
	lang="scss"
	scoped
>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url(https://www.guochaoxiaoju.com/uploads/mini/571.png) no-repeat;
		background-size: 100% auto;
	}

	.likeandPage_flex_0 {
		background: url(https://www.guochaoxiaoju.com/uploads/mini/571.png) no-repeat;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.likeandPage_fd0_0_c1_c0 {
		font-size: 40rpx;
		font-weight: 400;
		color: #000000;
		line-height: 88rpx;
	}

	.likeandPage_fd0_0_c0_c0 {
		font-size: 38rpx;
		color: #333;
	}

	.likeandPage_fd0_0_c0 {
		width: 120rpx;
	}

	.likeandPage_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.likeandPage_flex_1 {
		padding: 0rpx 30rpx 0rpx 30rpx;
		margin: 50rpx 0rpx 0rpx 0rpx;
	}

	.likeandPage_fd1_0_c0_c2 {
		width: 130rpx;
		height: 130rpx;
		border-radius: 8rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.likeandPage_fd1_0_c0_c1_c1_c1 {
		color: #999999;
		font-size: 22rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx 10rpx;
	}

	.likeandPage_fd1_0_c0_c1_c1_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
	}

	.likeandPage_fd1_0_c0_c1_c0 {
		margin: 0rpx 0rpx 28rpx 0rpx;
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
	}

	.likeandPage_fd1_0_c0_c1 {
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.likeandPage_fd1_0_c0_c0 {
		width: 108rpx;
		height: 108rpx;
		border-radius: 54rpx;
	}

	.likeandPage_fd1_0_c0 {
		margin: 0rpx 0rpx 40rpx 0rpx;
	}

	.likeandPage_flex_2 {
		padding: 0rpx 30rpx 0rpx 30rpx;
		margin: 50rpx 0rpx 0rpx 0rpx;
	}

	.likeandPage_fd2_0_c0_c2 {
		width: 130rpx;
		height: 130rpx;
		border-radius: 8rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.likeandPage_fd2_0_c0_c1_c3_c1 {
		color: #999999;
		font-size: 24rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx 8rpx;
	}

	.likeandPage_fd2_0_c0_c1_c3_c0 {
		width: 28rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.likeandPage_fd2_0_c0_c1_c3 {
		background: #E3E3E3;
		border-radius: 23rpx 23rpx 23rpx 23rpx;
		width: 167rpx;
		height: 46rpx;
		margin: 31rpx 0rpx 0rpx 0rpx;
	}

	.likeandPage_fd2_0_c0_c1_c2 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		margin: 16rpx 0rpx 0rpx 0rpx;
	}

	.likeandPage_fd2_0_c0_c1_c1_c1 {
		color: #999999;
		font-size: 22rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 0rpx 10rpx;
	}

	.likeandPage_fd2_0_c0_c1_c1_c0 {
		color: #333333;
		font-size: 28rpx;
		font-weight: 400;
	}

	.likeandPage_fd2_0_c0_c1_c0 {
		margin: 0rpx 0rpx 28rpx 0rpx;
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
	}

	.likeandPage_fd2_0_c0_c1 {
		margin: 21rpx 0rpx 0rpx 24rpx;
	}

	.likeandPage_fd2_0_c0_c0 {
		width: 108rpx;
		height: 108rpx;
		border-radius: 54rpx;
		margin: 11rpx 0rpx 0rpx 0rpx;
	}

	.likeandPage_fd2_0_c0 {
		margin: 0rpx 0rpx 40rpx 0rpx;
	}
</style>